package com.jieyang.oa.controller.login;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 29276
 * @version 1.0
 * @description: 校验验证码是否正确
 * @date 2021/8/14 16:18
 */
@WebServlet("/codeCheckServlet")
public class CodeCheckServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");

        resp.setContentType("text/html;charset=utf-8");
        resp.setCharacterEncoding("utf-8");

        String userCode = req.getParameter("userCode");
        String code = (String)req.getSession().getAttribute("randStr");
        resp.getWriter().write(code.equals(userCode)+"");

    }
}
